package com.hust360.percent.pojo;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

public abstract class Brand implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3009126338449520373L;
	public Long id;
	public String name;
	public String logo;

	public static final String ID = "id";
	public static final String NAME = "name";
	public static final String LOGO = "logo";
	public static final String[] COLUMNS = { ID, NAME, LOGO };

	public static final String TABLE = "brand";
	
	/**
	 * 获得当前区域中所有打折的列表
	 * 
	 * @return
	 */
	public abstract List<Discount> getDiscount();

	/**
	 * 获得当前区域中所有的店铺
	 */
	public abstract List<Shop> getShop();
	
	public long getRating() {
		List<Shop> list = this.getShop();
		long rate = 0;
		for (Shop s: list) {
			rate += s.getLiked();
		}
		return rate;
	}
	
	public abstract boolean isLiked(User user);
	
	public interface BrandDAO {
		public Brand findById(Long id);
		public void save(Brand brand);
		public List<Brand> findByMap (Map<String, String> map);
	}
}
